package com.kingyea.kim.base;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

import java.io.Serializable;
import java.util.List;

/**
 * 通用返回 VO (新)
 *
 * @param <T>
 */
@JsonIgnoreProperties(
        ignoreUnknown = true
)
@JsonInclude(Include.NON_NULL)
public class Result<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     *
     */
    private Integer code = ErrorMsg.SUCCESS.getCode();

    /**
     *
     */
    private String msg = ErrorMsg.SUCCESS.getMessage();

    /**
     * 总记录数
     * 一般用于分页时，总记录数
     */
    private Long count;

    /**
     * 实体
     */
    private T model;

    /**
     * 集合
     */
    private List<T> codeData;

    /**
     * 额外的返回数据
     * 一般为map
     */
    private Object extra;

    private PageQuery pageQuery;

    public Result() {
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    public T getModel() {
        return model;
    }

    public void setModel(T model) {
        this.model = model;
    }

    public List<T> getCodeData() {
        return codeData;
    }

    public void setCodeData(List<T> codeData) {
        this.codeData = codeData;
    }

    public Object getExtra() {
        return extra;
    }

    public void setExtra(Object extra) {
        this.extra = extra;
    }


    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public PageQuery getPageQuery() {
        return pageQuery;
    }

    public void setPageQuery(PageQuery pageQuery) {
        this.pageQuery = pageQuery;
    }
}

